function changes = countCopyNumChanges(tree, copyNumbers)
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here
[mat, id, dists] = getmatrix(tree);

maxCN = max(max(copyNumbers));
changes = zeros(maxCN + 1, maxCN + 1);
distIdx = 0;
for i = 1:size(mat, 2)
    for j = 1:size(mat, 1)
        if (mat(j, i) == 1)
           distIdx = distIdx + 1;
           %fprintf('connection between %d and %d\n', i, j);
           for k = 1:size(copyNumbers, 2)
               from = copyNumbers(j, k) + 1;
               to = copyNumbers(i, k) + 1;
               changes(from, to) = changes(from, to) + 1;
           end
        end

    end
end


end

